Skip to content

Conversation

@jeffcharles
Copy link
Collaborator

@jeffcharles jeffcharles commented Jan 7, 2026

This isn't ready to merge due to open questions about memory tracking.

image_range changed here on line 685 so it now only returns the size of the .text section in the ELF binary instead of the whole mmap'd file. The .text section is empty if the Wasm file has no functions. We were using the value returned by image_range to report an increase in memory usage to the Ruby GC. The implementation here will continue to track memory allocated for code and linear memory. However, memory physically allocated as part of allocating an anonymous mmap or reading a file-based mmap for the data segments, traps, dwarf symbols, and other sections won't be tracked. I can't find an equivalent API to get the size of the mmap other than performing a serialization of the module and checking its size which is very inefficient from a speed and memory perspective.

@jeffcharles
Copy link
Collaborator Author

I've opened bytecodealliance/wasmtime#12284 upstream for the image_size issue.

@jeffcharles
Copy link
Collaborator Author

A fix for that was merged but we'll need to a wait for a release that contains that fix before we can update Wasmtime.

@jeffcharles
Copy link
Collaborator Author

The fix is scheduled to ship as part of Wasmtime 41 which should be ready in roughly eleven days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants